package org.filecollector.filecontroller.virtualcatalogue;

import org.filecollector.filecontroller.virtualcatalogue.groupname.GroupName;

import java.util.Optional;
import java.nio.file.Path;
import java.util.OptionalLong;

/**
 * Interface encapsulates work with directories and inner files. Doesn't support subdirectories
 * <p>
 *     Prevent throwing everything
 * </p>
 * <p>
 *     Redirect to {@link VirtualCatalogueClass}
 * </p>
 */
public interface VirtualCatalogue {
    /**
     * @see VirtualCatalogueClass#exists(Long)
     */
    boolean exists(Long id);

    /**
     * @see VirtualCatalogueClass#readDirectly(Long, int)
     */
    Optional<char[]> readDirectly(Long id, int size);

    /**
     * @see VirtualCatalogueClass#addDirectly(Long, char[])
     */
    OptionalLong addDirectly(Long id, char[] buf);
    
    /**
     * @see VirtualCatalogueClass#getPath(Long)
     */
    Optional<Path> getPath(Long id);

    /**
     * @see VirtualCatalogueClass#getCheckSum(Long)
     */
    OptionalLong getCheckSum(Long id);

    /**
     * @see VirtualCatalogueClass#writeDirectly(Long, char[])
     */
    OptionalLong writeDirectly(Long id, char[] buf);

    /**
     * @see VirtualCatalogueClass#touch(Long)
     */
    OptionalLong touch(Long id);

    /**
     * @see VirtualCatalogueClass#checkId(Long) 
     */
    boolean checkId(Long id);

    /**
     * @see VirtualCatalogueClass#remove(Long)
     */
    boolean remove(Long id);

    /**
     * @see VirtualCatalogueClass#removeCatalogue()
     */
    boolean removeCatalogue();

    /**
     * @see VirtualCatalogueClass#listIds()
     */
    Long[] listIds();

    /**
     * @see VirtualCatalogueClass#listFreeDiapasons()
     */
    Long[][] listFreeDiapasons();

    /**
     * @see VirtualCatalogueClass#getName()
     */
    GroupName getName();
}
